<template>
  <el-dialog title="收货地址" :visible.sync="visible">
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="submit">提交</el-button>
      <el-button  @click="cancelBtnFn">取消</el-button>
    </div>
  </el-dialog>
<!--  <a-config-provider :locale="locale">
    <a-modal
        :title="type == 3 ? '选择岗位' : '选择用户'"
        :visible="visible"
        :width="1400"
        :destroyOnClose="true"
        @ok="sureBtnFn"
        @cancel="cancelBtnFn"
        :zIndex="9999"
        okText="提交"
        cancelText="取消">
      <div class="main_box_page">
        <div class="main_box_page_left">
          <selectTree
              :orgInfo="treeOrgInfo"
              @selectInfo="selectInfo"
              :showChildren="showChildren"
              :orgTreeList="orgTreeList"
              ref="modalTree"></selectTree>
        </div>
        <div class="main_box_page_right">
          &lt;!&ndash;  岗位与用户&ndash;&gt;
          <a-descriptions title="部门"></a-descriptions>
          <a-row type="flex" :gutter="[8, 8]" class="row-box">
            <a-col :md="4" :sm="24" class="part-tree">
              <a-tree
                  showLine
                  :selectedKeys="depart"
                  @select="partSelect"
                  :tree-data="departList"
                  :replaceFields="{ title: 'name', key: 'id', children: 'children' }">
              </a-tree>
            </a-col>
            &lt;!&ndash; 岗位树 &ndash;&gt;
            <a-col :md="4" :sm="24" class="menu-list">
              <a-checkbox-group v-if="type == 3" v-model="group" name="checkboxgroup">
                <div v-for="item in stationList" :key="item.id" class="check-group">
                  <a-checkbox :value="item.id + '_' + item.stationName"> </a-checkbox
                  ><span @click="getUser(item)"> {{ item.stationName }}</span>
                </div>
              </a-checkbox-group>
              <a-menu v-else v-model="current" mode="inline" @select="selectStation">
                <a-menu-item key="0">全部用户</a-menu-item>
                <a-menu-item
                    :value="item.remark"
                    :title="item.stationName"
                    v-for="item in stationList"
                    :key="item.id"
                >{{ item.stationName }}</a-menu-item
                >
              </a-menu>
            </a-col>
            &lt;!&ndash; 用户 &ndash;&gt;
            <a-col :md="24 - 8" :sm="24">
              &lt;!&ndash; 表头栏 &ndash;&gt;
              <a-row>
                <a-col :span="8">
                  <a-descriptions v-if="stationInfo.stationName">
                    <a-descriptions-item label="岗位">
                      {{ stationInfo.stationName }}</a-descriptions-item
                    >
                  </a-descriptions>
                  <span v-else>全部用户</span>
                </a-col>
                <a-col :span="4">
                  <div v-if="type != 3 && showSelf">
                    <a-descriptions>
                      <a-descriptions-item label="流程发起人">
                        <a-checkbox v-model="isSelf"></a-checkbox>
                      </a-descriptions-item>
                    </a-descriptions>
                  </div>
                </a-col>
                <a-col :span="12">
                  <div
                      style="
                      width: 100%;
                      display: flex;
                      justify-content: flex-end;
                      margin-bottom: 8px;
                    ">
                    <a-space :size="15">
                      <a-input-search
                          v-model.trim="queryParam.info"
                          placeholder="查找用户"
                          style="width: 200px"
                          @search="onSearch"
                          allowClear />
                    </a-space>
                  </div>
                </a-col>
              </a-row>
              &lt;!&ndash; Start table  &ndash;&gt;
              <a-table
                  bordered
                  :rowKey="
                  (record, index) => {
                    return record.userId;
                  }
                "
                  ref="table"
                  size="middle"
                  :pagination="ipagination"
                  :columns="columns"
                  :dataSource="orgUserList"
                  :loading="loading"
                  :rowSelection="
                  type == 3
                    ? null
                    : {
                        selectedRowKeys: selectedRowKeys,
                        onChange: onSelectChange,
                        type: type == 1 ? 'radio' : 'checkbox'
                      }
                "
                  @change="handleTableChange"
                  :scroll="{ y: 465 }">
              </a-table>
              &lt;!&ndash; End table  &ndash;&gt;
            </a-col>
          </a-row>
        </div>
      </div>
    </a-modal>
  </a-config-provider>-->
</template>
<script>
export default {
  data(){
    return {
      //可传参数
      type: 1, //类型(1单选人2多选人3岗位)默认单选必填
      showChildren: false, //是否展示子层级默认不展示
      orgTreeList: null, //组织树可选默认展示当前项目层级
      treeOrgInfo: {}, //展示项目树的信息(默认当前项目的信息)
      limit: "", //最多勾选的数量
      noEmpty: false, //是否默认必须勾选(默认不必)
      showSelf: false, //是否展示流程发起人勾选框(默认不展示,仅流程配置的时候展示)
      //不可传参数
      visible:false,
    };
  },
  methods: {
    // 初始化函数
    init() {
      this.visible = true;
      console.log("----:",this);
      // if (this.showSelf) {
      //   this.isSelf = this.selectionRows.some((item) => item.userId === "${startUserId}");
      // }
      //可以通过this.$xx的方式调用之后通过.then（表示确定）或.catch（表示取消）来表示是取消还是成功
      return new Promise((resolve, reject) => {
        this.promiseResult = {resolve, reject};
      });
    },
    // 确定函数
    sureBtnFn() {
      console.log(this.selectionRows, "选中的人");
      console.log(this.group, "选中的组");
      if (this.noEmpty && this.selectionRows.length == 0 && this.group.length == 0) {
        return this.$message.warning("请选中数据后提交!");
      }
      let selectData = [{name:'小小',age:12}] //this.type == 3 ? this.group : this.selectionRows;
      this.success(selectData);
      //执行销毁组件实例函数
      this.destruction();
    },
    // 取消函数
    cancelBtnFn() {
      // this.promiseResult.resject();
      this.cancel('取消');
      this.destruction();
    },
    // 销毁函数
    destruction() {
      this.visible = false;
      //   销毁实例
      this.$destroy(true);
      //将组件从body中移除
      this.$el.parentNode.removeChild(this.$el);
    },
    submit(){
      this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.sureBtnFn()
      }).catch(() => {
        this.cancelBtnFn() ;
      });
    },
  }
}
</script>
<style scoped>

</style>
